/*
 * @创建文件时间: 2021-06-01 22:41:21
 * @Auther: 猿小天
 * @最后修改人: 猿小天
 * @最后修改时间: 2021-06-05 01:03:36
 * 联系Qq:1638245306
 * @文件介绍: 角色管理接口
 */
import {request} from '@/api/service'

export const urlPrefix = '/api/system'

export function GetList(vm, query) {
  return request({
    url: get_url_prefix(vm),
    method: 'get',
    params: {...query, menu_id: vm.$route.params.id}
  })
}

export function GetObj(vm, obj) {
  return request({
    url: get_url_prefix(vm) + obj.id + '/' + `?menu_id=${vm.$route.params.id}`,
    method: 'get'
  })
}

export function createObj(vm, obj) {
  return request({
    url: get_url_prefix(vm) + `?menu_id=${vm.$route.params.id}`,
    method: 'post',
    data: obj
  })
}

export function UpdateObj(vm, obj) {
  return request({
    url: get_url_prefix(vm) + obj.id + '/' + `?menu_id=${vm.$route.params.id}`,
    method: 'put',
    data: obj
  })
}

export function DelObj(vm, id) {
  return request({
    url: get_url_prefix(vm) + id + '/' + `?menu_id=${vm.$route.params.id}`,
    method: 'delete',
    data: {id}
  })
}

export function get_url_prefix(vm) {
  return `${urlPrefix}/dynamic_table${vm.$route.query.code}/`
}
